#ifndef _SUB_
#define _SUB_

#include <iostream>
#include <vector>
#include <map>

#include <fstream>
#include <iostream>
#include <string>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

class mytime {
 public:
  virtual ~mytime();
  friend ostream& operator<< ( ostream& theStream, mytime& t );  
  friend istream& operator>> ( istream& theStream, mytime& t );  
  mytime & operator +=(double i);
  
 private:
  timeval time;
  char sep;
};

class sub_entry { 

 public:
  sub_entry(istream & in);
  virtual ~sub_entry();
  friend ostream& operator<< ( ostream& theStream, sub_entry& entry );
  sub_entry & operator +=(double i);
  
 private:
  int n;
  mytime from, to;
  string text;
  vector<string> lines;

};

class subtitle {
  
 public:  
  subtitle(const string & filename);
  subtitle();
  virtual ~subtitle();
  
  friend ostream& operator<< ( ostream& theStream, subtitle& sub );
  friend istream &operator>> (istream& theStream, subtitle& sub);

  subtitle & operator +=(double i);
  
 private:
  string filename;
  vector<sub_entry*> entries;
  void create_data(istream & theStream);

};


#endif
